package initial;

public class StringConstructorDemo {

    public static void main(String[] args) {

        String s1 = "hello"; //静态初始化
        String s2 = new String("hello"); //动态初始化
        String s3 = new String("hello".getBytes()); //通过字节数组初始化
        String s4 = new String("hello".toCharArray()); //通过字符数组初始化

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);


    }
}
